package com.company.beauty.common.config;

import com.company.beauty.common.async.AsyncConfigurerSupport;
import com.company.beauty.common.constants.BeanConditionalConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * <p>jackson bean configuration</p>
 *
 * @author youyoukele
 * @version 1.0
 * @date 2022/9/18
 */
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = BeanConditionalConstants.Prefix.COMMON_ASYNC, name = BeanConditionalConstants.FieldName.ENABLED, havingValue = "true", matchIfMissing = true)
@EnableAsync
public class AsyncConfiguration {

    @Bean
    public AsyncConfigurer asyncConfigurer(){
        log.info("common handler async configurer support!!!");
        return new AsyncConfigurerSupport();
    }

}
